﻿Public Class frmIndex

    Private Sub bt_atencion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_atencion.Click
        frmEdicionAtencion.ShowDialog()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim yes As Integer
        yes = MsgBox("Seguro desea Salir del sistema?", MsgBoxStyle.YesNo, "Salir")
        If yes = 6 Then
            If cadenaConexBD.State <> ConnectionState.Closed Then
                cadenaConexBD.Close()
            End If
            'Muestra el cuadro de mensaje antes de cerrar
            'frmAvisobdCompact.Show()
            'Timer1.Enabled = True
            Me.Close()
        End If
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        frmInfoAsesorAtencion.ShowDialog()
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        frmInfoRankingAtencion.ShowDialog()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim importarBD As OpenFileDialog = New OpenFileDialog
        cadenaConexBD.Close()

        importarBD.Title = "Buscar Base de datos a importar"
        importarBD.Filter = "Base de datos (*.mdb)|*.mdb"
        Dim pathBackup As DialogResult = importarBD.ShowDialog()

        If pathBackup = Windows.Forms.DialogResult.OK Then
            frmImportar.lblcadena.Text = importarBD.FileName
            importcadenaConexBD(importarBD.FileName)
            frmImportar.ShowDialog()
        End If

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Dim pathBase As String
        Dim pathDestino As String
        Dim explorar As FolderBrowserDialog = New FolderBrowserDialog
        'comentario de prueba
        If explorar.ShowDialog() = DialogResult.OK Then
            cadenaConexBD.Close()
            pathBase = Application.StartupPath & "\db\auditoria.mdb"
            explorar.ShowNewFolderButton = False
            'explorar.ShowDialog()
            pathDestino = explorar.SelectedPath & "\auditoriabk.mdb"
            ' My.Computer.FileSystem.CopyFile(pathBase, pathDestino, Microsoft.VisualBasic.FileIO.UIOption.AllDialogs)
            My.Computer.FileSystem.CopyFile(pathBase, pathDestino, Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing)
            'FileCopy(pathBase, pathDestino)
            MsgBox("Operación Realizada Con Éxito", MsgBoxStyle.Information, "Auditoria")
        End If
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        frmNewControlador.ShowDialog()
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        frmNewAuditado.ShowDialog()
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        frm_empresa.ShowDialog()
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        frmInfoEmprAtencion.ShowDialog()
    End Sub
   
    Private Sub bt_ventas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_ventas.Click
        frmVentas.ShowDialog()
    End Sub

    Private Sub bt_pvtas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_pvtas.Click
        frmPosVentas.ShowDialog()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        frmInfoAsesorVentas.ShowDialog()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        frmInfoEmprVentas.ShowDialog()
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        frmInfoAsesorPostVentas.ShowDialog()
    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        frmInfoEmprPostVentas.ShowDialog()
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        frmInfoRankingVtaPosvta.Show()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Try
            cadenaConexBD.Close()
            CompactaryReparar()
        Catch ex As Exception
            MessageBox.Show("No se puede terminar de Compactar la base de datos por que la misma no pudo cerarrse correctamente, este proceso se realizara la proxima vez que se ejecute el sistema", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
        frmAvisobdCompact.Close()
        Me.Close()
    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
        frmSearchLlamadas.mfgridResultados.Clear()
        frmSearchLlamadas.mfgridResultados.Cols = 1
        frmSearchLlamadas.rbtAtencion.Checked = True
        frmSearchLlamadas.ShowDialog()
    End Sub

    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        frmSelectLlamadas.ShowDialog()
        'frmExportExcel.ShowDialog()
    End Sub

    Private Sub frmIndex_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btConfig_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btConfig.Click
        frmConfig.ShowDialog()
    End Sub
End Class